/**
 * @name: tarotBigCard.service
 * @data: 2024/5/29 13:51
 */
import {Provide} from "@midwayjs/core";
import {InjectEntityModel} from "@midwayjs/typeorm";
import TarotBigCard from "../pojo/entity/tarotBigCard.entity";
import {Repository} from "typeorm";

@Provide()
export class TarotBigCardService{
  @InjectEntityModel(TarotBigCard)
  tarotBigCardModel:Repository<TarotBigCard>

  /**
   * @description 获取全部卡牌
   */
  async selectAllTarotBigCard(){
    return await this.tarotBigCardModel.find();
  }

  /**
   * @description 根据卡牌id获取卡牌
   * @param tarotBigCardId 卡牌id
   */
  async selectTarotBigCardById(tarotBigCardId:number){
    return await this.tarotBigCardModel.findOneBy({tarotBigCardId});
  }

  /**
   * @description 根据name模糊查询
   * @param name name字段
   */
  async selectTarotBigCardByName(name: string) {
    return await this.tarotBigCardModel.query(`select * from tarot_big_card where name like '%${name}%'`);
  }


}
